import { createRouter, RouteOption, createWebHashHistory, createWebHistory } from 'vue-router';

// 公共路由
const constantRoutes: RouteOption[] = [
	{
		path: '/',
		component: () => import('@/views/index.vue')
	},
	{
		path: '/web_color',
		component: () => import('@/views/modules/web_color/index.vue')
	},
	{
		path: '/str_edit',
		component: () => import('@/views/modules/str_edit/index.vue')
	},
	{
		path: '/clock_tomato',
		component: () => import('@/views/modules/clock_tomato/index.vue')
	},
	{
		path: '/clock_tomato/set_time',
		component: () => import('@/views/modules/clock_tomato/frame/set_time/index.vue')
	},
	{
		path: '/clock_tomato/list',
		component: () => import('@/views/modules/clock_tomato/frame/tomato_list/index.vue')
	},
	{
		path: '/clock_tomato/corner',
		component: () => import('@/views/modules/clock_tomato/frame/corner/index.vue')
	},
	{
		path: '/img_edit',
		component: () => import('@/views/modules/img_edit/index.vue')
	},
	{
		path: '/img_edit/tool',
		component: () => import('@/views/modules/img_edit/frame/tool/index.vue')
	},
	{
		path: '/img_edit/passport',
		component: () => import('@/views/modules/img_edit/frame/passport/index.vue')
	},
	{
		path: '/coc',
		component: () => import('@/views/modules/coc/index.vue')
	},
	{
		path: '/coc/labels',
		component: () => import('@/views/modules/coc/frame/labels/index.vue')
	}
];

/**
 * 创建路由 正式环境使用hash路由
 */
const router = createRouter({
	history: import.meta.env.VITE_APP_ENV == 'development' ? createWebHistory(import.meta.env.VITE_APP_CONTEXT_PATH) : createWebHashHistory(import.meta.env.VITE_APP_CONTEXT_PATH),
	routes: constantRoutes
});

export default router;
